<?php
require_once BASEPATH."lib/MCore/Controller/Action/Basic.php";
include_once BASEPATH. "application/news/models/News.php";

class News_AdmnewsController extends MCore_Controller_Action_Basic
{

	/** public function indexAction() {{{
	 *
	 *
	 *
	 */
	public function indexAction()
	{
		$this->render();
	}
	/*}}}*/

	/**  {{{
	 *
	 *
	 *
	 */
	public function listAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->getListJson());
	}

	/**  {{{
	 *
	 *
	 *
	 */
	public function editAction()
	{
		$news = new News();

		$this->view->news = $news->find($this->request["Id"]);
		$this->view->submit = "update";
		$this->render();
	}

	/** public function newAction() {{{
	 *
	 *
	 *
	 */
	public function newAction()
	{
		$news = new News();
		$row = $news->getDo()->fetchNew();
		$row->Date = date("Y-m-d H:i:s");

		$this->view->news = $row;
		$this->view->submit = "insert";
		$this->render("edit");
	}
	/*}}}*/


	/** public function insertAction()  {{{
	 *
	 *
	 *
	 */
	public function insertAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->insert($this->request));
	}
	/*}}}*/

	/** public function updateAction() {{{
	 *
	 *
	 *
	 */
	public function updateAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->update($this->request));
	}
	/*}}}*/

	/** public function deleteAction() {{{
	 *
	 *
	 *
	 */
	public function deleteAction()
	{
		$news = new News();

		$this->_helper->viewRenderer->setNoRender();

        $this->getResponse()->setBody($news->delete($this->request['Id']));
	}
	/*}}}*/

}
?>
